/******************************************************************************
* This file is part of is32p218 platform,
* Copyright (c) 2009 HangZhou InfoStrong CO.,LTD. All rights reserved.
* This software may only be used under the terms of a valid, current,
* end user license from InfoStrong.
* Nothing else gives you the right to use this software.   
*
* Name:   plc_hl_event.h
* Desc:   PLC HL event routine header file
* Author: Jerry
* Date:   2011-05-20
* Note:   
* History:
*
******************************************************************************/
#include "def.h"
#include "isOS.h"
#include "sys_glb.h"
#include "plc.h"
#include "afn_def.h"
#include "plc_if.h"

#ifndef __PLC_HL_EVENT_H__
#define __PLC_HL_EVENT_H__

#ifdef __cplusplus
extern "C" {
#endif

//#define PLC_EVENT_RESEND_MAX		50				// This value: demo, about 15min
#define PLC_EVENT_RESEND_MAX		(50*230)		// This value: Normal, about 2days
#define PLC_EVENT_RESEND_RESET_IF	(64)			// About 16min

typedef enum
{
	PLC_HL_RSP_STATUS_OK,
	PLC_HL_RSP_STATUS_FAIL,
	PLC_HL_RSP_STATUS_BUSY,
	PLC_HL_RSP_STATUS_NO_BIND

}PLC_HL_RSP_STATUS_T;

typedef struct
{
	U16 m_event_resend_cnt;				// Event-report error counter
}PLC_HL_EVENT_CTLR_T;

BOOL plc_hl_event_init( void );
#if (!defined(MASTER_NODE)&&defined(EVENT_REPORT))
BOOL plc_hl_event_snd_busy( void  );
#endif
BOOL plc_hl_event_dl_proc( U8 *p_msg_data, U16 len, MSG_PLC_T msg_type, BOOL *p_msg_rel_flg );
BOOL plc_hl_event_dl_moni_proc( U8 *p_msg_data, U16 len, MSG_PLC_T msg_type, BOOL *p_msg_rel_flg );
BOOL plc_hl_event_app_send( U8 *p_msg_data, U16 len, MSG_PLC_T msg_type, BOOL *p_msg_rel_flg );
BOOL plc_hl_event_app_active( U8 *p_msg_data, U16 len, MSG_PLC_T msg_type, BOOL *p_msg_rel_flg );
BOOL plc_hl_event_app_ack( U8 *p_msg_data, U16 len, MSG_PLC_T msg_type, BOOL *p_msg_rel_flg );

#ifdef __cplusplus
}
#endif

#endif // end __PLC_HL_EVENT_H__





